<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/public.jsp" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增销售计划</title>
	<script type="text/javascript">
		$(document).ready(function(){
			var d = new Date()
			var vYear = d.getFullYear()
			var vMon = d.getMonth() + 1
			var vDay = d.getDate()
			var h = d.getHours();
			var m = d.getMinutes();
			var se = d.getSeconds();
			var date= d.toLocaleDateString();
			s=vYear+(vMon<10 ? "0" + vMon : vMon)+(vDay<10 ? "0"+ vDay : vDay)+
			(h<10 ? "0"+ h : h)+(m<10 ? "0" + m : m)+(se<10 ? "0" +se : se);
//			var s=getDate();
			var planId="BP"+s+$("#id").val();
			$("#buyPlanId").val(planId);
			$("#createTime").val(date);
			$("#proposerId").val(window.userId);
			$("#proposer").val(window.username);

			var   tt   =   1;
			$("#selectUser").click(function(){
						tt   =   tt?0:1;
						if(tt){
							var userId=$("#selectUser").find("option:selected").val();
							var userName=$("#selectUser").find("option:selected").text();
							$("#approverId").val(userId);
							$("#approver").val(userName);
						}
					}
			);

		});

	</script>
	<script type="text/javascript" src="${ctx}/js/checkFrom.js"></script>
</head>
<body>
<input type="hidden" id="id" value="${id}"/>
<a  href="${ctx}/buyPlan/list">添加采购计划</a>
<hr />
<form action="${ctx }/buyPlan/save" method="post">
	<input type="hidden" name="buyPlanId" id="buyPlanId">
	<input type="hidden" name="createTime" id="createTime">
	<input type="hidden" name="proposerId" id="proposerId">
	<input type="hidden" name="approverId" id="approverId">
	<input type="hidden" name="propStatus" id="propStatus" value="4">
	<input type="hidden" name="approverOpinion" id="approverOpinion" >
	<input type="hidden" name="planSumMoney" id="planSumMoney" value="0"/>

<table style="width: 350px;margin: auto;">
<tr>
	<td>销售计划ID</td>
     <td>
		 <select name="salePlanId">
			 <c:forEach items="${salePlanList}" var="salePlan">
				 <option>${salePlan.salePlanId}</option>
			 </c:forEach>
		 </select>
	 </td>
</tr>

	<tr>
		<td>申请人</td>
		<td><input type="text" name="proposer" id="proposer" readonly /></td>
	</tr>
	<tr>
		<td>审批人</td>
		<td><input type="text" name="approver" id="approver" readonly></td>
		<td>
			<select id="selectUser">
				<c:forEach items="${userList }" var="user">
					<option value="${user.id}">${user.username}</option>
				</c:forEach>
			</select>
		</td>
	</tr>

	<tr>
		<td>备注</td>
		<td><input type="text" name="remarks" id="remarks" /></td>
	</tr>


	<td></td>
	<td><input type="submit" value="保存"> </td>
</tr>
</table>
</form>
</body>
</html>